home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / easyx / data1.cab / Example_Files / EX_4 / Form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-11-03  |  2.5 KB  |  77 lines

  1. VERSION 5.00
  2. Object = "{5A65A9C0-089F-11D2-88AD-0000B45C4CF6}#1.2#0"; "EASYX.OCX"
  3. Begin VB.Form Form1 
  4.    Caption         =   "Form1"
  5.    ClientHeight    =   3195
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   4680
  9.    Icon            =   "Form1.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3195
  12.    ScaleWidth      =   4680
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin PROJECTEXLibCtl.EasyX EasyX 
  15.       Left            =   960
  16.       OleObjectBlob   =   "Form1.frx":014A
  17.       Top             =   120
  18.    End
  19. Attribute VB_Name = "Form1"
  20. Attribute VB_GlobalNameSpace = False
  21. Attribute VB_Creatable = False
  22. Attribute VB_PredeclaredId = True
  23. Attribute VB_Exposed = False
  24. Option Explicit
  25. Dim TextSurface As Long
  26. Dim TextSprite As Long
  27. Const pTextHeight As Long = 100
  28. Const pTextWidth As Long = 200
  29. Const ScreenWidth As Long = 640
  30. Const ScreenHeight As Long = 480
  31. Dim XPoint As Long, YPoint As Long
  32. Const MovePrLoop As Long = 1
  33. Private Sub RunMain()
  34.     EasyX.FillSurface RGB(255, 255, 255), EX_PRIMARYSURFACE
  35.     EasyX.DrawSprite XPoint, YPoint, pTextWidth, pTextHeight, TextSprite
  36.     'update the movement variables
  37.     YPoint = YPoint - MovePrLoop
  38.     If YPoint + pTextHeight < 0 Then
  39.         YPoint = ScreenHeight
  40.         EasyX.EndDirectX
  41.         Unload Me
  42.         Exit Sub
  43.     End If
  44.     EasyX.FlipSurface
  45.     DoEvents
  46. End Sub
  47. Private Sub Form_Load()
  48. Dim rt As Long
  49. Dim AppPath As String
  50. 'Do not forget this
  51. EasyX.Window = Me.hWnd
  52. AppPath = App.Path & "\"
  53. rt = EasyX.InitDirectDraw(ScreenWidth, ScreenHeight, 8)
  54. If rt <> EX_OK Then
  55.     EasyX.EndDirectX
  56.     MsgBox "Direct Draw could not initialize", vbOKOnly, "Failure"
  57.     Exit Sub
  58. End If
  59. 'Set the surfacetext
  60. TextSurface = EasyX.LoadBitmapFile(AppPath & "textsurface.bmp", 0)
  61. If TextSurface < 0 Then
  62.     EasyX.EndDirectX
  63.     MsgBox "Direct Draw could create text surface", vbOKOnly, "Failure"
  64.     Exit Sub
  65. End If
  66. EasyX.SetText TextSurface, RGB(255, 255, 255), 0, 14, "Verdana"
  67. TextSprite = EasyX.MakeSprite(0, 0, 200, 100, TextSurface)
  68. 'Print the text
  69. EasyX.PrintText TextSurface, "This is a scrolling text example" & vbCrLf _
  70.                            & "Use Newline characters to print to a new line" _
  71.                            & vbCrLf & vbCrLf & "    EasyX ver 1.2", 0, 0, 200, 100
  72. 'initialize the movement variables
  73. YPoint = ScreenHeight
  74. XPoint = ScreenWidth / 2 - pTextWidth / 2
  75. RunMain
  76. End Sub
  77.